#include <stdio.h>
#include <stdlib.h>
#include <dirent.h>
#include <string.h>

void print(const char* path)
{
	DIR * dir = opendir(path);
	if(!dir)
	{
		return;
	}
	else
	{
		struct dirent * ent ;
		while(ent = readdir(dir))
		{
			if(ent->d_type == 4)
			{
				printf("dirctory of name : [%s]\n",ent->d_name);
				if((strcmp(".",ent->d_name)) == 0 || (strcmp("..",ent->d_name)) == 0)
					continue;
				char buf[100];
				sprintf(buf , "%s/%s" , path , ent->d_name );
				//printf("%s\n",buf);
				print(buf);
			}
			else
			{
				printf("file of name : %s\n",ent->d_name);
			}
		}
	}
}

int main()
{
	print("../day01");
}
